package com.ruoyi.web.controller.qsng;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.qsng.domain.KClearinghouseLike;
import com.ruoyi.qsng.service.IKClearinghouseLikeService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 交流中心_点赞Controller
 * 
 * @author kanglou
 * @date 2023-06-07
 */
@RestController
@RequestMapping("/qsng/like")
@Api(tags = "pc--交流中心_点赞Controller")
public class KClearinghouseLikeController extends BaseController
{
    @Autowired
    private IKClearinghouseLikeService kClearinghouseLikeService;

    /**
     * 查询交流中心_点赞列表
     */
    @PreAuthorize("@ss.hasPermi('qsng:like:list')")
    @GetMapping("/list")
    @ApiOperation(value = "查询交流中心_点赞列表")
    public TableDataInfo list(KClearinghouseLike kClearinghouseLike)
    {
        startPage();
        List<KClearinghouseLike> list = kClearinghouseLikeService.selectKClearinghouseLikeList(kClearinghouseLike);
        return getDataTable(list);
    }

    /**
     * 导出交流中心_点赞列表
     */
    @PreAuthorize("@ss.hasPermi('qsng:like:export')")
    @Log(title = "交流中心_点赞", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ApiOperation(value = "导出交流中心_点赞列表")
    public void export(HttpServletResponse response, KClearinghouseLike kClearinghouseLike)
    {
        List<KClearinghouseLike> list = kClearinghouseLikeService.selectKClearinghouseLikeList(kClearinghouseLike);
        ExcelUtil<KClearinghouseLike> util = new ExcelUtil<KClearinghouseLike>(KClearinghouseLike.class);
        util.exportExcel(response, list, "交流中心_点赞数据");
    }

    /**
     * 获取交流中心_点赞详细信息
     */
    @PreAuthorize("@ss.hasPermi('qsng:like:query')")
    @GetMapping(value = "/{id}")
    @ApiOperation(value = "获取交流中心_点赞详细信息")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(kClearinghouseLikeService.selectKClearinghouseLikeById(id));
    }

    /**
     * 新增交流中心_点赞
     */
    @PreAuthorize("@ss.hasPermi('qsng:like:add')")
    @Log(title = "交流中心_点赞", businessType = BusinessType.INSERT)
    @PostMapping
    @ApiOperation(value = "新增交流中心_点赞")
    public AjaxResult add(@RequestBody KClearinghouseLike kClearinghouseLike)
    {
        return toAjax(kClearinghouseLikeService.insertKClearinghouseLike(kClearinghouseLike));
    }

    /**
     * 修改交流中心_点赞
     */
    @PreAuthorize("@ss.hasPermi('qsng:like:edit')")
    @Log(title = "交流中心_点赞", businessType = BusinessType.UPDATE)
    @PutMapping
    @ApiOperation(value = "修改交流中心_点赞")
    public AjaxResult edit(@RequestBody KClearinghouseLike kClearinghouseLike)
    {
        return toAjax(kClearinghouseLikeService.updateKClearinghouseLike(kClearinghouseLike));
    }

    /**
     * 删除交流中心_点赞
     */
    @PreAuthorize("@ss.hasPermi('qsng:like:remove')")
    @Log(title = "交流中心_点赞", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    @ApiOperation(value = "删除交流中心_点赞")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(kClearinghouseLikeService.deleteKClearinghouseLikeByIds(ids));
    }
}
